package com.masterclient.app.modules.shop.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eoner.baselibrary.bean.shop.DealerShippingItemBean;
import com.masterclient.app.R;

/**
 * @auther hjian
 * @date 2020/9/12.
 */
public class DealerShippingListAdapter extends BaseQuickAdapter<DealerShippingItemBean, BaseViewHolder> {

    private String selectId;

    public String getSelectId() {
        return selectId;
    }

    public DealerShippingListAdapter() {
        super(R.layout.item_dealer_shipping_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, DealerShippingItemBean item) {
        if ("1".equals(item.getCheck_delivery())){
            selectId = item.getDelivery_id();
        }
        helper.setText(R.id.item_dealer_shipping_name, item.getTitle())
                .setImageResource(R.id.item_dealer_shipping_select, "1".equals(item.getCheck_delivery())?R.mipmap.dealer_radio_select:R.mipmap.dealer_radio_default)
                .setGone(R.id.item_dealer_shipping_default, "1".equals(item.getIs_default()))
                .addOnClickListener(R.id.item_dealer_shipping_select);
    }
}
